package com.bigknow.appstore.common;

/**
 * Fusion 包装异常
 */
public class AppStoreWrapperException extends Exception {

    private static final long serialVersionUID = -7363787792928625297L;

    private String className;

    public AppStoreWrapperException(Throwable t) {
        super(t.getMessage(), t.getCause() != t && t.getCause() != null ? new AppStoreWrapperException(t.getCause()) : null);
        setStackTrace(t.getStackTrace());
        if (t instanceof AppStoreWrapperException) {
            className = ((AppStoreWrapperException) t).className;
        } else {
            className = t.getClass().getName();
        }
    }

    @Override
    public String toString() {
        String msg = getLocalizedMessage();
        return (msg != null) ? (className + ": " + msg) : className;
    }
}